package ink.zhaohui.javaStudy;

import java.util.*;
import ink.zhaohui.javaStudy.rules.*;
import org.jeasy.rules.api.Facts;
import org.jeasy.rules.api.Rules;
import org.jeasy.rules.api.RulesEngine;
import org.jeasy.rules.core.DefaultRulesEngine;
import org.jeasy.rules.api.RulesEngineParameters;

public class App{
    public static void main(String[] agrs){
        // define facts
        List<String> code=new LinkedList();
        Facts facts = new Facts();
        facts.put("age", 16);
        facts.put("code", code);
        
       
        Rules rules = new Rules();
        rules.register(new Age());
        
        // fire rules on known facts
        RulesEngineParameters parameters = new RulesEngineParameters().skipOnFirstAppliedRule(true);
        RulesEngine rulesEngine = new DefaultRulesEngine(parameters);
        rulesEngine.fire(rules, facts);
        
        for(String c:code){
            System.out.println(c);
        }
    }
}